<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
  <head>
	<link rel="shortcut icon" href="http://localhost:8080${pageContext.request.contextPath}/img/logo.jpg">
    <title>导入试题</title>
<!-- Bootstrap -->
	<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
	<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
	<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
	<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
	<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
	<style type="text/css">
		/* 选择器：1.标签 2.class 3.id */
		.lbimg{
			width: 100%;
		}
		.dvfooter{
			position: absolute;
			bottom: 2px;
			height: 40px;
			background-color: #0062CC;
			width: 100%;
		}
		/*表单样式*/
		#form{
			margin: 10px;
			margin-top: 50px;
			padding: 50px;
			background-color: #f8F8F8;
		}
		body{
			background-color: #FAFAFA;
		}
		/*表格样式*/
		table{
			table-layout:fixed;
			word-wrap:break-word;
		}
		th {
			text-align: center;
		}
		td {
			white-space:nowrap;
			overflow:hidden;
			text-overflow: ellipsis;
			text-align: center;
		}
	</style>
	  
  </head>
  <body>
    <div class="container">
    	<div class="row clearfix">
    	    <div class="col-md-12 column">
    		 	<nav class="navbar navbar-default" role="navigation">
    		 		<div class="navbar-header">
    		 			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
							 <span class="sr-only">Toggle navigation</span>
							 <span class="icon-bar"></span>
							 <span class="icon-bar"></span>
							 <span class="icon-bar"></span>
    					</button>
						<img src="http://localhost:8080${pageContext.request.contextPath}/img/label.jpg" class="navbar-brand" style="">
    		 		</div>
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
						<ul class="nav navbar-nav navbar-right">
							<li>
								<a href="${pageContext.request.contextPath}/index.jsp">首页</a>
							</li>
							<li>
								<c:if test="${sessionScope.user!=null}">
									<a href="${pageContext.request.contextPath}/api/task/show.do">任务</a>
								</c:if>
								<c:if test="${sessionScope.user==null}">
									<a href="${pageContext.request.contextPath}/safety/usertasklist.jsp">任务</a>
								</c:if>
							</li>
							<li  class="active">
								<a href="${pageContext.request.contextPath}/api/question/showAll.do">题库</a>
							</li>
							<li>
								<c:if test="${sessionScope.user==null}">
									<a href="${pageContext.request.contextPath}/login.jsp">登陆</a>
								</c:if>
								<c:if test="${sessionScope.user!=null}">
									<a href="${pageContext.request.contextPath}/safety/my.jsp">我的</a>
								</c:if>
							</li>
						</ul>
                    </div>
    		 	</nav>
    		</div>
    	</div>
    	<div class="row" id="form">
			<div class="row">
				<div class="col-xl-12">
					<form action="${pageContext.request.contextPath}/api/question/query.do" method="post" class="form-horizontal" role="form">
						<div class="form-group">
							<input type="text" name="title" class="form-control" placeholder="请输入试题关键字"/>
						</div>
						<div>
							<div style="width:95%;padding:0;margin:0;float:left;box-sizing:border-box;">
								<a href="${pageContext.request.contextPath}/safety/questionadd.jsp" class="btn btn-primary">新增试题</a>&nbsp;&nbsp;
								<a href="${pageContext.request.contextPath}/safety/questionupload.jsp" class="btn btn-primary">批量导入</a>
							</div>
							<div style="width:5%;padding:0;margin:0;float:left;box-sizing:border-box;">
								<input type="submit" class="btn btn-primary" value="查询">
							</div>
						</div>
					</form>
				</div>
			</div>
			<div class="row">
				<table class="table">
					<thead>
					<tr>
						<th>序号</th>
						<th>类型</th>
						<th>试题</th>
						<th>答案</th>
						<th>出题人</th>
						<th>状态</th>
						<th>时间</th>
					</tr>
					</thead>
					<tbody>
						<c:if test="${empty qlist}">
							<tr>
								<td colspan="7">没有查询到数据！</td>
							</tr>
						</c:if>
						<c:if test="${qlist.size()>0}">
							<c:forEach items="${qlist}" var="q" varStatus="vs">
								<tr>
									<td>${vs.index + 1}</td>
									<td>${q.type==4?"简答题":"其他"}</td>
									<td title="${q.title}">${q.title}</td>
									<td title="${q.answer}">${q.answer}</td>
									<td title="${q.uname}">${q.uname}</td>
									<td>${q.flag==1?"有效":"无效"}</td>
									<td title="${q.ctime}">${q.ctime}</td>
								</tr>
							</c:forEach>
						</c:if>
						</tbody>
					<tfoot>
					<tr>
						<td colspan="7" align="center">
							<ul class="pagination">
								<li>
									<a href="#">上一页</a>
								</li>
								<li>
									<a href="#">1</a>
								</li>
								<li>
									<a href="#">2</a>
								</li>
								<li>
									<a href="#">3</a>
								</li>
								<li>
									<a href="#">4</a>
								</li>
								<li>
									<a href="#">5</a>
								</li>
								<li>
									<a href="#">下一页</a>
								</li>
							</ul>
						</td>
					</tr>
					</tfoot>
				</table>
			</div>
		</div>
    </div>
    <script src="http://localhost:8080${pageContext.request.contextPath}/js/jquery-3.4.1.min.js"></script>
    <script src="http://localhost:8080${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
  </body>
</html>